# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative './mendix_utils'
generate_mendix_delegate

def common_pods
  # Comment the next line if you don't want to use dynamic frameworks
  # use_frameworks!

  # RN development pods
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])
  # RN pods end

  # Manually linked dependencies
  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'

  # Third party dependencies of dependencies
  pod 'IQKeyboardManager'

  # At least one permission must be added when `react-native-permissions` used
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"

  # Required MendixNative dependency
  pod 'SSZipArchive'
end

target 'nativeTemplate' do
  generate_pod_dependencies
  use_native_modules!
  common_pods
  # Intentionally left empty
  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'react-native-amap3d', :path => '../node_modules/react-native-amap3d'

  pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'

  pod 'RNLocalize', :path => '../node_modules/react-native-localize'

  pod '@mauron85_react-native-background-geolocation', :path => '../node_modules/@mauron85/react-native-background-geolocation'

end

target 'dev' do
  generate_pod_dependencies
  use_native_modules!
  common_pods
  # Intentionally left empty
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == "React"
        if config.name == "ReleaseDevApp"
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "DEBUG=1"
        end
      end
    end
  end
end
